import {CellStateStyle, Graph, Guide, PolylineShape} from "@maxgraph/core";

export default function (graph: Graph) {
    // 修改一些常量的样式 由于constants.ts中的常量是只读的，所以需要在这里重新定义
    const MY_GUIDE_COLOR = '#509eff';
    const MY_GUIDE_STROKEWIDTH = 1.5;
    // @ts-ignore
    Guide.prototype.createGuideShape = function(horizontal?: boolean) {
        const guide = new PolylineShape([], MY_GUIDE_COLOR, MY_GUIDE_STROKEWIDTH);
        // debugger
        guide.isDashed = true;
        return guide;
    }
    // @ts-ignore
    Guide.prototype.getGuideColor = function (isDashed?: boolean) {
        return MY_GUIDE_COLOR;
    }
    const vertexStyles: CellStateStyle = graph.stylesheet.getDefaultVertexStyle()
    vertexStyles.strokeColor = 'black';
    vertexStyles.strokeOpacity = 100;
    vertexStyles.strokeWidth = 1.5;
    vertexStyles.fillColor = '#fff';
    vertexStyles.fillOpacity = 100
    vertexStyles.fontColor = 'black';
    vertexStyles.fontSize = 12;
    // vertexStyles.rotatable = true;
    vertexStyles.rounded = true;
    vertexStyles.editable = true


    const edgeStyles: CellStateStyle = graph.stylesheet.getDefaultEdgeStyle()
    edgeStyles.strokeColor = 'black';
    edgeStyles.strokeWidth = 1.5
    edgeStyles.fontSize = 12;
    edgeStyles.edgeStyle = 'orthogonalEdgeStyle';
    edgeStyles.rounded = true;  // 设置圆角
}